#pragma once
#include "afxwin.h"
#include "Business/Policy/CallAuctionBusiness.h"


// CCallActionBusinessSettingDlg dialog

class CCallAuctionBusinessSettingDlg : public CDialog
{
	DECLARE_DYNAMIC(CCallAuctionBusinessSettingDlg)

public:
	enum OPERATE_TYPE {ADD,UPDATE_BALANCE};

	CCallAuctionBusinessSettingDlg(CallAuctionArgument const& argument, 
		ContractCodes const& contracts, 
		OPERATE_TYPE operateType);   // standard constructor
	virtual ~CCallAuctionBusinessSettingDlg();

// Dialog Data
	enum { IDD = IDD_CALL_AUCTION_BUSINESS_SETTING_DLG };

	CallAuctionArgument const& GetArgument() const {return m_argument;}

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
private:
	CComboBox m_majorCombo;
	CComboBox m_minorCombo;
	CEdit m_bullishOpenBalanceEdit;
	CEdit m_bullishOffsetBalanceEdit;
	CEdit m_bearishOpenBalanceEdit;
	CEdit m_bearishOffsetBalanceEdit;
	CEdit m_majorPrePrice;
	CEdit m_minorPrePrice;
	CEdit m_maxQuantity;
	CButton m_useLimitPriceCheck;
	CEdit m_majorLimitPercentEdit;
	CEdit m_minorLimitPercentEdit;

	CallAuctionArgument m_argument;
	ContractCodes const& m_contracts;
	OPERATE_TYPE m_operateType;

protected:
	afx_msg void OnCbnSelchangeMajorCombo();
	afx_msg void OnBnClickedBtnOk();
	afx_msg void OnBnClickedBtnCancel();
	afx_msg void OnBnClickedLimitPriceCheck();

	virtual BOOL OnInitDialog();

private:
	void UpdateArgument();
	void InitComboData();
	void InitControlText(int majorContract, int minorContract);
	void InitComboSel(CComboBox& combo,int contract);
	void DisableControl();
	bool Validate() const;
	void InitMinorCombo(UINT majorContract);
};
